package org.e_gold.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {

	public static String getDateByPattern(String pattern) {

		return new SimpleDateFormat(pattern).format(new Date());
	}

	public static String getDate() {

		return getDateByPattern("dd-MM-YYYY HH:mm:ss");
	}

	public static String getDate(Date d){
		String pattern = "YYYY-MM-dd HH:mm:ss";
		Calendar cal = Calendar.getInstance();
		cal.setTime(d);

		return new SimpleDateFormat(pattern).format(d);
	}
}
